package com.csnf.hymall.dao.imp;

import com.csnf.hymall.dao.ProductOrderMapper;
import com.csnf.hymall.entity.ProductOrder;

import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class ProductOrderMapperImp extends BaseMapperImp implements ProductOrderMapper {

    @Override
    public int getOrderTotal(String startDate, String endDate,int state) {
        try {
            String sql = "SELECT COUNT(productOrder_id) FROM productOrder WHERE productOrder_status = ? " +
                    "AND productOrder_confirm_date BETWEEN ? AND ?";
            int count = getTotalCount(sql, state, startDate, endDate);//要确保参数的顺序、类型等都与 SQL 语句中的占位符严格对应
            return count;
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
